/* GUI CONVERTED from rcrsdup.p (converter v1.75) Sat Aug 12 23:00:40 2000 */
/* rcrsdup.p - Customer Schedules : Copy Line To Remote Database        */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                   */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                 */
/* REVISION: 7.3    LAST MODIFIED: 08/13/93           BY: WUG *GE19*    */
/* REVISION: 7.3    LAST MODIFIED: 04/11/95           BY: ame *F0QB*    */
/* REVISION: 7.3    LAST MODIFIED: 08/02/95           BY: bcm *G0TB*    */
/* REVISION: 8.6    LAST MODIFIED: 05/20/98           BY: *K1Q4* Alfred Tan */
/* REVISION: 8.6E   LAST MODIFIED: 01/20/2000         BY: *J3NH* Ashwini G. */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00           BY: *N0KP* myb        */


/* UPDATE REMOTE DATABASE SO DETAIL RECORD */
/*J3NH*/ /* REPLACE THE LOGIC OF COPYING THROUGH 'NULL' STREAM BY */
/*J3NH*/ /* BUFFER-COPY STATEMENT                                 */

/*F0QB*/  {mfdeclre.i}

          define input parameter sod_recid as recid.

/*J3NH**  define new shared frame hf_sod_det. */
/*J3NH**  define stream nullstream.           */
          define variable old_db as character.
/*F0QB*/  define variable sdb_err as integer no-undo.
/*J3NH*/  define new shared workfile work_sod_det no-undo like sod_det.

/*F0QB*   {mfdeclre.i}*/

/*J3NH** BEGIN DELETE **
 *            form
 *               sod_det
 *               except sod_sch_data
 *            with frame hf_sod_det.
 *
 *            form
 *               sod_sch_data       format "x(40)"
 *            with frame hf_sod_det.
 *J3NH** END DELETE **/

         find sod_det where recid(sod_det) = sod_recid no-lock.

/*G0TB*/  /* WE NEED TO USE THE sod_det INFORMATION SINCE THE HEADER
         SITE REPRESENTS THE AR SITE IN CUSTOMER SCHEDULES */
/*G0TB*/  find si_mstr where si_site = sod_site no-lock.


/*G0TB**  find so_mstr where so_nbr = sod_nbr no-lock.   **/
/*G0TB**  find si_mstr where si_site = so_site no-lock.  **/

      if si_db <> global_db then do:

/*J3NH** BEGIN DELETE **
 *       do with frame hf_sod_det:
 *         {mfoutnul.i &stream_name=nullstream}
 *         disp stream nullstream sod_det with frame hf_sod_det.
 *         output stream nullstream close.
 *       end.
 *J3NH** END DELETE **/

/*J3NH*/ create work_sod_det.
/*J3NH*/ buffer-copy sod_det to work_sod_det.
/*J3NH*/ if recid(work_sod_det) = -1 then .
          old_db = global_db.
/*F0QB*      create alias qaddb for database value(si_db).*/
/*F0QB*      global_db = si_db.*/
/*F0QB*/     {gprun.i ""gpalias3.p"" "(input si_db, output sdb_err)"}
/*GUI*/ if global-beam-me-up then undo, leave.


          {gprun.i ""rcrsdupa.p""}
/*GUI*/ if global-beam-me-up then undo, leave.

/*F0QB*      create alias qaddb for database value(old_db).*/
/*F0QB*      global_db = old_db.*/
/*F0QB*/     {gprun.i ""gpalias3.p"" "(input old_db, output sdb_err)"}
/*GUI*/ if global-beam-me-up then undo, leave.

      end. /* IF SO_SB <> GLOBAL_DB */
